package com.project.baseApp;

import android.app.Application;
import android.graphics.Bitmap;

import com.example.mybaseproject.R;
import com.support.universalimageloader.core.DisplayImageOptions;
import com.support.universalimageloader.core.ImageLoader;
import com.support.universalimageloader.core.ImageLoaderConfiguration;
import com.support.universalimageloader.core.assist.ImageScaleType;
import com.support.universalimageloader.core.display.FadeInBitmapDisplayer;

public class BaseApplication extends Application {
	private int w, h, dpi;

	@Override
	public void onCreate() {
		super.onCreate();
		initImageLoader();
	}

	private void initImageLoader() {
		DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
				.showImageForEmptyUri(R.drawable.ic_image_error).showImageOnFail(R.drawable.ic_image_error)
				.resetViewBeforeLoading(false).cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY)
				.bitmapConfig(Bitmap.Config.RGB_565).displayer(new FadeInBitmapDisplayer(300)).build();
		ImageLoaderConfiguration imageLoaderConfig = new ImageLoaderConfiguration.Builder(getApplicationContext())
				.discCacheFileCount(100).defaultDisplayImageOptions(defaultOptions).build();
		ImageLoader.getInstance().init(imageLoaderConfig);
	}

}
